
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>通过鼠标改变图片</title>
    <script type="text/javascript">
        function myImageA() {
            document.all.myPic.src = "1.jpg";
        }
        function myImageB() {
            document.all.myPic.src = "2.jpg";
        }
    </script>
</head>
<body>
    <div style="text-align: center;">
        <p>在图片内外移动鼠标，图片轮换</p>
        <img name="myPic" id="myPic" src="1.jpg" >
    </div>
<script type="text/javascript">
    document.all.myPic.onmouseover = myImageA;
    document.all.myPic.onmouseout = myImageB;
</script>
</body>
</html>